// menu.ts
import { LogicalPosition } from '@tauri-apps/api/window';
import { Menu } from '@tauri-apps/api/menu';
import { controlWindow } from './windows';
import router from '@/router'
(async () => {
    const menu = await Menu.new({
        items: [
            {
                id: 'delete',
                text: '返回登录',
                action: async () => {
                    await controlWindow('main','resize',{width:315,height:445});
                    router.push('/');
                },
            },
            {
                id: 'quit',
                text: '退出',
                action: async () => {
                    await controlWindow('main','close');
                },
            },
        ],
    });
    await menu.setAsAppMenu();

    window.addEventListener('contextmenu', async (event) => {
        event.preventDefault();
        menu.popup(new LogicalPosition(event.clientX, event.clientY));
    });
})();